const { ErrorMessageModel } = require("../model/reModel");

/**
 * 检查是否登陆
 * @param {*} req  请求信息
 * @param {*} res  返回res
 * @param {*} next 链式操作下一步
 * @returns
 */
const loginCheck = (req, res, next) => {
  if (req.session.username) {
    next();
    return;
  }
  res.json(ErrorMessageModel(null, "你还未登陆，请先登陆！", "3"));
};

module.exports = loginCheck;
